/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-12-11
 * Time: 21:31
 */
public class Main {
    public static boolean isPalindrome(String s) {
       //创建左右指针
        int left=0;
        int right=s.length()-1;
        //将所有的大写转化为小写
        s=s.toLowerCase();
        //判断左右是否相等
        while (left<right){
            while(left<s.length()&&!((s.charAt(left)>=48&&s.charAt(left)<=57)||(s.charAt(left)>='a'&&s.charAt(left)<='z'))){
                left++;
            }

            while(right>=0&&!((s.charAt(right)>=48&&s.charAt(right)<=57)||(s.charAt(right)>='a'&&s.charAt(right)<='z'))){
                right--;
            }
            if(left>=right){
                return true;
            }

            if(s.charAt(left)==s.charAt(right)){
                left++;
                right--;
            }else {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        String s=".,";
        System.out.println(isPalindrome(s));
    }
}